home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc International / Development / TSMTEsample⁄1.1 / Source / SamplePart.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-14  |  6.7 KB  |  226 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        SamplePart.h
  3.  
  4.     Contains:    Sample part editor class implementation
  5.  
  6.     Written by:    Steve Smith
  7.     
  8.     Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  9. */
  10.  
  11. #ifndef _SAMPLEPART_
  12. #define _SAMPLEPART_
  13.  
  14. // -- Compiler/Preprocessor Switches --
  15.  
  16. #ifndef _COMPILERDEFS_
  17. #include "CompDefs.h"
  18. #endif
  19.  
  20. // -- OpenDoc Includes --
  21.  
  22. #ifndef _ODTYPES_
  23. #include <ODTypes.h>
  24. #endif
  25.  
  26. // -- Macintosh Includes --
  27.  
  28. #ifndef __TYPES__
  29. #include <Types.h>
  30. #endif
  31.  
  32. // -- Forward Declarations --
  33.  
  34. class ODFacet;
  35. class ODFocusSet;
  36. class ODFrame;
  37. class ODMenuBar;
  38. class ODShape;
  39. class ODStorageUnit;
  40. class ODWindow;
  41. class CList;
  42.  
  43. struct WindowProperties;
  44.  
  45.  
  46. //ForTSMTE
  47. #ifndef __tsmUtl__    
  48. #include "tsmUtl.h"
  49. #endif
  50.  
  51. #pragma import on
  52.  
  53. class SamplePart {
  54.     
  55.       //==================================
  56.       // Overridden Public ODPart Methods
  57.       //==================================
  58.     public:
  59.     
  60.     SamplePart();
  61.     virtual ~SamplePart();
  62.     
  63.     // -- Initialization --
  64.     
  65.     void        InitPart(Environment* ev, ODStorageUnit* storageUnit,
  66.                                         ODPart* partWrapper);
  67.     void        InitPartFromStorage(Environment* ev, ODStorageUnit* storageUnit,
  68.                                         ODPart* partWrapper);
  69.     
  70.     // -- Storage --
  71.     
  72.     void        Release(Environment* ev);
  73.     void        ReleaseAll(Environment* ev);
  74.     ODSize        Purge(Environment* ev, ODSize size);
  75.     void        Externalize(Environment* ev);
  76.     void        ExternalizeKinds(Environment* ev, ODTypeList* kindset);
  77.     void        ChangeKind(Environment* ev, ODType kind);
  78.     void        CloneInto(Environment* ev, ODDraftKey key,
  79.                                         ODStorageUnit* destinationSU,
  80.                                         ODFrame* initiatingFrame);
  81.     void        WritePartInfo(Environment* ev, ODInfoType partInfo,
  82.                                         ODStorageUnitView* storageUnitView);
  83.     ODInfoType    ReadPartInfo(Environment* ev, ODFrame* frame,
  84.                                         ODStorageUnitView* storageUnitView);
  85.     void        ClonePartInfo(Environment *ev, ODDraftKey key, ODInfoType partInfo,
  86.                                         ODStorageUnitView* storageUnitView,
  87.                                         ODFrame* scopeFrame);
  88.     
  89.     // -- Layout --
  90.     
  91.     void        DisplayFrameAdded(Environment* ev, ODFrame* frame);
  92.     void        DisplayFrameRemoved(Environment* ev, ODFrame* frame);
  93.     void        DisplayFrameClosed(Environment* ev, ODFrame* frame);
  94.     void        DisplayFrameConnected(Environment* ev, ODFrame* frame);
  95.     void        AttachSourceFrame(Environment* ev, ODFrame* frame,
  96.                                         ODFrame* sourceFrame);
  97.     void        ViewTypeChanged(Environment* ev, ODFrame* frame);
  98.     void        FrameShapeChanged(Environment* ev, ODFrame* frame);
  99.     ODID        Open(Environment* ev, ODFrame* frame);
  100.         
  101.     // -- Imaging --
  102.     
  103.     void        Draw(Environment* ev, ODFacet* facet, ODShape* invalidShape);
  104.     void        GeometryChanged(Environment* ev, ODFacet* facet,
  105.                                         ODBoolean clipShapeChanged,
  106.                                         ODBoolean externalTransformChanged);
  107.     void        HighlightChanged(Environment* ev, ODFacet* facet);
  108.     void        FacetAdded(Environment* ev, ODFacet* facet);
  109.     void        FacetRemoved(Environment* ev, ODFacet* facet);
  110.     
  111.     // -- Activation --
  112.     
  113.     ODBoolean    BeginRelinquishFocus(Environment* ev, ODTypeToken focus,
  114.                                         ODFrame* ownerFrame,
  115.                                         ODFrame* proposedFrame);
  116.     void        CommitRelinquishFocus(Environment* ev, ODTypeToken focus,
  117.                                         ODFrame* ownerFrame,
  118.                                         ODFrame* proposedFrame);
  119.     void        AbortRelinquishFocus(Environment* ev, ODTypeToken focus,
  120.                                         ODFrame* ownerFrame,
  121.                                         ODFrame* proposedFrame);
  122.     void        FocusAcquired(Environment* ev,ODTypeToken focus,
  123.                                         ODFrame* ownerFrame);
  124.     void        FocusLost(Environment* ev,ODTypeToken focus,
  125.                                         ODFrame* ownerFrame);
  126.     
  127.     // -- Event Handling --
  128.     
  129.     ODBoolean    HandleEvent(Environment* ev, ODEventData* event,
  130.                                         ODFrame* frame, ODFacet* facet,
  131.                                         ODEventInfo* eventInfo);
  132.     void        AdjustMenus(Environment* ev, ODFrame* frame);
  133.     
  134.     
  135.       //===================================
  136.     // Newly Introduced Internal Methods
  137.       //===================================
  138.     protected:
  139.     
  140.     // -- Initialization --
  141.     
  142.     void        Initialize(Environment* ev);
  143.     
  144.     // -- Storage --
  145.     
  146.     void        CheckAndAddProperties(Environment* ev,
  147.                                         ODStorageUnit* storageUnit);
  148.     void        CleanseContentProperty(Environment* ev,
  149.                                         ODStorageUnit* storageUnit);
  150.     void        InternalizeStateInfo(Environment* ev,
  151.                                         ODStorageUnit* storageUnit);
  152.     void        InternalizeContent(Environment* ev,
  153.                                         ODStorageUnit* storageUnit);
  154.     void        ExternalizeStateInfo(Environment* ev,
  155.                                         ODStorageUnit* storageUnit,
  156.                                         ODDraftKey key, ODFrame* scopeFrame);
  157.     void        ExternalizeContent(Environment* ev, ODStorageUnit* storageUnit,
  158.                                         ODDraftKey key, ODFrame* scopeFrame);
  159.     void        SetDirty(Environment* ev);
  160.     
  161.     // -- Event Handling --
  162.     
  163.     ODBoolean    HandleMenuEvent(Environment* ev, ODEventData* event,
  164.                                            ODFrame* frame);
  165.     ODBoolean    HandleMouseEvent(Environment* ev, ODEventData* event,
  166.                                         ODFacet* facet, ODEventInfo* eventInfo);
  167. //ForTSMTE
  168. //    void        DoMouseEvent(Environment* ev, ODFacet* facet, Point* where);
  169.     void        DoMouseEvent(Environment* ev, ODFacet* facet, Point* where, ODEventData* event);
  170.     void        DoDialogBox(Environment* ev, ODFrame* frame,
  171.                                           ODSShort dialogID, ODUShort errorNumber = 0);
  172.     
  173.     // -- Imaging --
  174.     
  175.     void        DrawFrameView(Environment* ev, ODFacet* facet);
  176.     void        DrawIconView(Environment* ev, ODFacet* facet);
  177.     void        DrawThumbnailView(Environment* ev, ODFacet* facet);
  178.     PicHandle    GenerateThumbnail( Environment*    ev, ODFrame* frame);
  179.     
  180.     // -- Activation --
  181.     
  182.     void        PartActivated(Environment* ev, ODFrame* frame);
  183.     ODBoolean    ActivateFrame(Environment* ev, ODFrame* frame);
  184.     void        WindowActivating(Environment* ev, ODFrame* frame,
  185.                                         ODBoolean activating);
  186.     void        RelinquishAllFoci(Environment* ev, ODFrame* frame);
  187.     
  188.     // -- Layout --
  189.     
  190.     ODWindow*    AcquireFramesWindow(Environment* ev, ODFrame* frame);
  191.     ODWindow*    CreateWindow(Environment* ev, ODFrame* frame, ODType frameType,
  192.                                         WindowProperties* windowProperties);
  193.     void        CleanupWindow(Environment* ev, ODFrame* frame);
  194.     WindowProperties*    GetDefaultWindowProperties(Environment* ev, ODFrame* frame,
  195.                                         Rect* windowRect);
  196.     WindowProperties*    GetSavedWindowProperties(Environment* ev, ODFrame* frame);
  197.     Rect        CalcPartWindowSize(Environment* ev, ODFrame* sourceFrame);
  198.     Rect        CalcPartWindowPosition(Environment* ev, ODFrame* frame,
  199.                                         Rect* partWindowBounds);
  200.     ODFacet*    GetActiveFacetForFrame(Environment* ev, ODFrame* frame);
  201.     ODShape*    CalcNewUsedShape(Environment* ev, ODFrame* frame);
  202.     void        UpdateFrame(Environment* ev, ODFrame* frame, ODTypeToken view,
  203.                                         ODShape* usedShape);
  204.     void        CleanupDisplayFrame(Environment* ev, ODFrame* frame,
  205.                                         ODBoolean frameRemoved);
  206.     void        ZoomPartWindow(Environment* ev, ODFrame* frame, ODWindow* window,
  207.                                         ODBoolean openingWindow);
  208.                                         
  209.     
  210.       //========================
  211.     private:
  212.  
  213.     CList*        fDisplayFrames;
  214.     ODBoolean    fDirty;
  215.     ODPart*        fSelf;
  216.     ODBoolean    fReadOnlyStorage;
  217.     
  218.     ODBoolean    fGlobalsInited;
  219.  
  220.     //ForTSMTE
  221.     tsmUtlRec    fTERec;
  222. };
  223.  
  224. #pragma import off
  225.  
  226. #endif